class Solution {
    string str[10] = {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
    vector<string> ret;
    string path;
    int sz;
public:
    vector<string> letterCombinations(string digits) {
        sz = digits.size();
        if(sz != 0)
            dfs(digits, 0);
        return ret;    
    }

    void dfs(string digits, int pos)
    {
        if(sz == pos)
        {
            ret.push_back(path);
            return;
        }

        for(char& e : str[digits[pos] - '0'])
        {
            path += e;
            dfs(digits, pos + 1);
            path.pop_back();
        }
    }
};